import type { AxiosRequestConfig } from '@vben/request';

import { requestClient } from '#/api/request';
import { ServicePrefixEnum } from '#/enums/commonEnum';

const MODULAR = 'anyTenant/demo';

export const FormValidatorConfig = {
  Save: {
    url: `${ServicePrefixEnum.GENERATOR}/${MODULAR}/save`,
    method: 'POST',
  } as AxiosRequestConfig,
  Update: {
    url: `${ServicePrefixEnum.GENERATOR}/${MODULAR}/update`,
    method: 'PUT',
  } as AxiosRequestConfig,
};

export namespace FormValidatorApi {
  export async function save(params: any) {
    return requestClient.request2<any>({
      ...FormValidatorConfig.Save,
      params,
    });
  }

  export async function update(params: any) {
    return requestClient.request2<any>({
      ...FormValidatorConfig.Update,
      params,
    });
  }
}
